//
//  ZJTaskCell.m
//  这家测试项目
//
//  Created by IOS_DEVELOPER on 2017/7/11.
//  Copyright © 2017年 陈志凌. All rights reserved.
//

#import "ZJTaskCell.h"

@implementation ZJTaskCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.sureBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.sureBtn.layer.borderWidth = 0.3f;
}

-(void)setModel:(ZJTaskModel *)model{
    
    _model = model;
    self.taskName.text = _model.mission_name;
    
    if ([_model.status integerValue] == 0) {
        self.money.text = _model.money;
    }
    
    switch ([_model.mission_code integerValue]) {
        case 1000:
            [self.sureBtn setTitle:@"签到" forState:0];
            break;
            
        case 1001:
            [self.sureBtn setTitle:@"认证" forState:0];
            break;
            
        case 1003:
            [self.sureBtn setTitle:@"评论" forState:0];
            break;
            
        case 1004:
            [self.sureBtn setTitle:@"前往" forState:0];
            break;
            
        case 1005:
            [self.sureBtn setTitle:@"分享" forState:0];
            break;
            
        case 1006:
            [self.sureBtn setTitle:@"分享" forState:0];
            break;
            
        case 1007:
            [self.sureBtn setTitle:@"报名" forState:0];
            break;
            
        case 1008:
            [self.sureBtn setTitle:@"前往" forState:0];
            break;
            
        default:
            break;
    }
    
    if ([_model.status integerValue] == 1) {
        
        self.money.text = @"";
        self.icon.image = [UIImage imageWithContentsOfFile:[Utils imgPath:@"rw_icon_hba@3x.png"]];
        [self.sureBtn setTitle:@"已完成" forState:0];
        [self.sureBtn setBackgroundColor:[Utils colorWithHexString:allConstHexColor]];
        [self.sureBtn setTitleColor:[UIColor whiteColor] forState:0];
        self.sureBtn.userInteractionEnabled = NO;
        
    }else{
        self.money.text = [NSString stringWithFormat:@"+%.2f",[_model.money doubleValue]];
    }
    
    if ([_model.status integerValue] == 2) {
        self.money.text = [NSString stringWithFormat:@"+%.2f",[_model.money doubleValue]];
    }
}

@end
